package tec.stan.ling.topo.model;

import org.xmappr.Attribute;

import tec.stan.ling.core.notifier.Notification;
import tec.stan.ling.core.notifier.impl.NotificationImpl;
import tec.stan.ling.core.top.model.Node;
import tec.stan.ling.core.top.model.Subnet;

public abstract class NodeImpl extends NEImpl implements Node {

	private Subnet parent;

	@Attribute
	private int x = 0;

	@Attribute
	private int y = 0;

	public Subnet getParent() {
		return parent;
	}

	public void setParent(Subnet subnet) {
		this.parent = subnet;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		int oldX = this.x;
		this.x = x;
		if (isDeliver()) {
			notify(new NotificationImpl(this, Notification.SET, Node.NODE_X,
					oldX, x));
		}
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		int oldY = this.y;
		this.y = y;
		if (isDeliver()) {
			notify(new NotificationImpl(this, Notification.SET, Node.NODE_Y,
					oldY, y));
		}
	}
}
